package gui;

import java.awt.Color;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;

import model.MetroModel;
import model.objects.EdiStation;
import gui.properties.*;
import gui.view.*;
import gui.view.android.AndroidDrawerView;
import gui.view.drawers.editor.StandardDrawer;
import gui.view.standard.StandardView;

public class EditorPanel extends JPanel {
	private static final long serialVersionUID = 1L;
	private MetroModel model = MetroModel.getInstance();
	private ActiveMetroView firstView;// = new StandardView(model, new StandardDrawer());
	private MetroView secondView = new AndroidDrawerView();//new StandardView(model, new StandardDrawer());
	private final EditorWindowSettings settings = new EditorWindowSettings();
	private final PropertiesPanel properties = new PropertiesPanel();
	
	public PropertiesPanel getProperties() {
		return properties;
	}

	public EditorPanel(JFrame parent) {
		firstView = new StandardView(model, new StandardDrawer(),parent);
		firstView.setBorder(BorderFactory.createLineBorder(Color.red, 2));
		secondView.setBorder(BorderFactory.createLineBorder(Color.red, 2));
		  
		this.setLayout(new EditorLayout(firstView, secondView, properties, settings));		 
		//properties.setLayout(new ListLayout());	
		
		model.addModelChangeListener(firstView);
		model.addModelChangeListener(secondView);
		model.addModelChangeListener(properties);
		
		this.firstView.addSelectionListener(properties);
		this.add(properties);
		this.add(firstView);
		this.add(secondView);		
		
	}
	
	public MetroModel getModel() {
		return model;
	}

	public MetroView getFirstView() {
		return firstView;
	}

	public void setFirstView(ActiveMetroView firstView) {
		this.firstView = firstView;
	}

	public MetroView getSecondView() {
		return secondView;
	}

	public void setSecondView(MetroView secondView) {
		this.secondView = secondView;
	}

	public EditorWindowSettings getSettings() {
		return settings;
	}

	public void setModel(MetroModel model) {
		model = model;
	}
}
